home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcoop.arc / TCOOP2.ARC / MSMOUSE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-26  |  2.3 KB  |  80 lines

  1. // Mouse class: msmouse.h 
  2.  
  3. #ifndef H_MSMOUSE
  4. #define H_MSMOUSE
  5.  
  6. // Defines graphics mouse cursor styles
  7.  
  8. struct HotSpotStruct { int X, Y; };
  9.  
  10. struct MouseCursor {
  11.   HotSpotStruct HotSpot;
  12.   unsigned ScreenMask[16];
  13.   unsigned CursorMask[16];
  14. };
  15.  
  16. extern const MouseCursor ArrowCursor;
  17. extern const MouseCursor HandCursor;
  18. extern const MouseCursor LeftRightCursor;
  19. extern const MouseCursor UpDownCursor;
  20.  
  21. // Mouse event codes 
  22.  
  23. const unsigned Idle             = 0x0000;
  24. const unsigned MouseDown        = 0xff01;
  25. const unsigned LMouseDown       = 0xff01;
  26. const unsigned RMouseDown       = 0xff02;
  27. const unsigned MouseStillDown   = 0xff04;
  28. const unsigned LMouseStillDown  = 0xff04;
  29. const unsigned RMouseStillDown  = 0xff08;
  30. const unsigned MouseUp          = 0xff10;
  31. const unsigned LMouseUp         = 0xff10;
  32. const unsigned RMouseUp         = 0xff20;
  33. const unsigned MouseEnter       = 0xff40;
  34. const unsigned MouseLeave       = 0xff80;
  35. const unsigned MouseWithin      = 0xffc0;
  36.  
  37. // Mouse Button Masks 
  38.  
  39. const unsigned  LeftButton      =  0x0001;
  40. const unsigned  RightButton     =  0x0002;
  41.  
  42. // The video modes that the mouse is running under
  43. enum VideoModeType {TextScrn, LowResGr, HerculesGr, Graphics};
  44.  
  45. // The mouse class 
  46.  
  47. class MouseObject {
  48. protected:
  49.   int OldX, OldY;   // Used solely by Moved to keep        
  50.   char OK;          // True if mouse initialized           
  51.   char MouseOff;    // True if mouse is disabled (Default) 
  52.   char LowRes;      // True if in 320x200 graphics mode    
  53.   char TextMode;    // True if in text mode                
  54. public:
  55.   int X, Y, Dx, Dy; // Keeps track of the mouse's movement       
  56.   MouseObject(void);
  57.   void Setup(VideoModeType VideoMode);
  58.   int  DriverExists(void);
  59.   int  SetupOK(void);
  60.   void Hide(void);
  61.   void Show(void);
  62.   unsigned Status(int &Mx, int &My);
  63.   unsigned ButtonStatus(void);
  64.   int PressCnt(unsigned ButtonMask);
  65.   int ReleaseCnt(unsigned ButtonMask);
  66.   unsigned Event(int &Mx, int &My);
  67.   unsigned WaitForAnyEvent(int &Mx, int &My);
  68.   void WaitForEvent(unsigned E, int &Mx, int &My);
  69.   int  Moved(void);
  70.   void Move(int Mx, int My);
  71.   void TurnOn(void);
  72.   void TurnOff(void);
  73.   int  Operating(void);
  74.   void SetGCursor(const MouseCursor &NewCursor);
  75. };
  76.  
  77. extern MouseObject Mouse;
  78.  
  79. #endif
  80.